import {request} from "../utils/request"
//查询订单列表
export const queryList = (data:any) => {
    return request({
        url: "/shoporder/query",
        method: "GET",
        data: data,
    });
};
//查询订单详细根据id
export const selectOrder = (orderId: number) => {
    return request({
        url: `/shoporder/getOrderInfo/${orderId}`,
        method: "GET",
    });
}
//创建订单
export const createOrder = (data:any)=>{
    return request({
        url:"/shoporder/add",
        method:"POST",
        data:data
    })
}
//钱包支付
export const payByWallet = (data:any)=>{
    return request({
        url:"/pay/create",
        method:"POST",
        data:data
    })
}
//获取用户余额
export const getBalance = (userId:number)=>{
    return request({
        url:`/user/getUserInfoAPI/${userId}`,
    })
}
//支付宝支付
export const payByAlipay = (data:any)=>{
    return request({
        url:"/pay/alipay",
        method:"POST",
        data:data
    })
}
//微信支付
export const payByWechat = (data:any)=>{
    return request({
        url:"/pay/wxPay",
        method:"POST",
        data:data
    })
}
//获取支付状态
export const checkOrderStatus = (data:any)=>{
    return request({
        url:`/pay/getPayStatus`,
        method:"GET",
        data: data
    })
}
//退款
export const cancelOrderApi = (orderNumber:any)=>{
    return request({
        url:`/shoporder/close/${orderNumber}`,
        method:"POST",
    })
}
//提交评价
export const addComment = (orderId: number,commentInfo:String) => {
    return request({
        url: `/shoporder/comment/${orderId}/${commentInfo}`,
        method: "Post",
    });
}
//确认收货,修改状态为3
export const confirmOrder = (orderId: number) => {
    return request({
        url: `/shoporder/confirm/${orderId}`,
        method: "Post",

    })
}
